#include "Kareltje.h"
#include <math.h>
Kareltje::Kareltje(bool cflag) : Allocator(cflag, "Kareltje")
{

}

Kareltje::~Kareltje()
{
}

void Kareltje::free(Area *ap) {

}


void Kareltje::SetSize(int wantedSize)
{
    require(size > 0);
    size = wantedSize;
    Allocator::setSize(wantedSize);
}

Area Kareltje::alloc(int wanted)
{
    require(wanted > 0);
    require(wanted <= size);

    Area *ap = 0;
    ap = searcher(wanted);		// first attempt
    return &ap;
}
int  Kareltje::firstPower2(int needed)  {

    int count = 0;

    while(pow(2,count) < needed) {
        count++;
    }

return pow(2,count);
}
